<!DOCTYPE html>
<html lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>云尚奥莱</title>
    <link rel="stylesheet" href="../themes/mall/default/styles/share/css/hui.css">
    <link rel="stylesheet" href="../themes/mall/default/styles/share/css/style.css">
    <script src="/mobile/themes/mall/default/styles/share/js/com.js"></script>
    <script src="/mobile/themes/mall/default/styles/share/js/hui.js"></script>
    <script src="/mobile/themes/mall/default/styles/share/js/template-web.js"></script>
</head>
<body>
<style type="text/css">
    #tank{position: fixed;top: 0;left: 0;right: 0;bottom: 0;background: rgba(0,0,0,0.5);z-index: 10;display: none}
    /*#tank .nr{position: absolute;width: 650px;height: 470px;left: 50%;margin-left: -328px;margin-top: -257px;background: linear-gradient(#DD8185,#DD4C79);top: 50%;border-radius: 16px}*/
    #tank .nr{position: absolute;width: 80%;height: 35%;left: 48%;margin-left: -368px;margin-top: -257px;background: linear-gradient(#DD8185,#DD4C79);top: 50%;border-radius: 54px}
    #tank .nr .tit{font-size: 54px;text-align: center;color:#fff;padding-top: 120px}
    #tank .nr .btn{color:#fff;text-align:center;width: 70%;height: 64px;line-height: 60px;margin-left: 15%;margin-top: 85px;background: linear-gradient(#DFCB70,#DDBA5D);border-radius: 50px;font-size: 40px;}
    #tank .nr .desc{color:#fff;text-align:center;line-height: 75px;margin-top: 70px;font-size: 42px}
</style>
<div id="tank">
    <div class="nr">
        <input type="hidden" id="code" value="{$code}">
        <div class="tit copy">邀请码：{$code}</div>
        <div class="btn copy">下载APP</div>
        <div class="desc">
            请先下载APP,注册并粘贴此邀请码<br>
            此邀请码为{$code}
        </div>
    </div>
</div>

<div style="background: no-repeat center center none;background-size: cover" class="w100per h100per" id="bgcontain">
    <div style="position:fixed;width: 100%;top:0;left:0;right: 0;" onclick="test();">
        <img src="/mobile/themes/mall/default/styles/share/img/websitetitle.jpg"  >
    </div>
    <div style="padding-top: 135px">
        <img src="/mobile/themes/mall/default/styles/share/img/website.jpg"  alt="">
    </div>
    <div id="contain"></div>
</div>
</body>
<script src="//cdn.bootcss.com/jquery/1.12.4/jquery.min.js"></script>

    <script>
        function test(){
            var code = $("#code").val();
            if(code){
                $("#tank").css("display","block");
            }else{
                var u = navigator.userAgent;
                var ua = u.toLowerCase();
                if (/iphone|ipad|ipod/.test(ua)) {  // iOS 系统 ->  跳AppStore下载地址
                    //alert("iOS");
                    window.location.href = 'https://apps.apple.com/cn/app/%E4%BA%91%E5%B0%9A%E5%A5%A5%E8%8E%B1/id1465194574';
                } else if ( /android/.test(ua)) { // 安卓系统 -> 跳安卓端下载地址
                    window.location.href = 'https://a.app.qq.com/o/simple.jsp?pkgname=com.yunshang.ecmall';
                } else if (IsPC()){ // PC端

                }
            }
        }

        $(function () {
            //复制功能
            var copyBtn = document.querySelector('.copy');
            var html = '@'+$("#code").val()+'@';
            $(".show").click(function(){
                $("#tank").css("display","block");
            })
            $(".btn").click(function(){
                var u = navigator.userAgent;
                var ua = u.toLowerCase();
                copytext(html)
                if (/iphone|ipad|ipod/.test(ua)) {  // iOS 系统 ->  跳AppStore下载地址
                    window.location.href = 'https://apps.apple.com/cn/app/%E4%BA%91%E5%B0%9A%E5%A5%A5%E8%8E%B1/id1465194574';
                } else if ( /android/.test(ua)) { // 安卓系统 -> 跳安卓端下载地址
                    window.location.href = 'https://a.app.qq.com/o/simple.jsp?pkgname=com.yunshang.ecmall';
                } else if (IsPC()){ // PC端
                }
            })
            // 页面加载完毕获取图片的宽度和高度
            $(window).load(function () {
                let w = $('#help_img').width();
                let h = $('#help_img').height();

                $('#help_p').css({
                    "width": w + 'px',
                    "height": w + 'px',
                    "line-height": h + 'px',
                    'left': 0,
                });
            });
            copyBtn.onclick = function() {
                copytext(html)
                return false;
            }
            function copytext(html) {
                var oInput = document.createElement('input');
                oInput.value = html;
                document.body.appendChild(oInput);
                // oInput.select();
                selectText(oInput)
                document.execCommand("Copy");
                oInput.className = 'oInput';
                oInput.style.display = 'none';
                alert('复制成功！');
            }
            function selectText(oInput) {
                if(oInput.createTextRange) {//ie
                    oInput.select();
                }else{//firefox/chrome
                    oInput.setSelectionRange(0, oInput.value.length);
                    oInput.focus();
                }
            }

            $("#tank").click(function(){
                $(this).css('display','none');
            })
        });




        // window.onload = function () {
        //     goDownload()
        // };
        // function goDownload() {
        //     var u = navigator.userAgent;
        //     var ua = u.toLowerCase();
        //     if (/iphone|ipad|ipod/.test(ua)) {  // iOS 系统 ->  跳AppStore下载地址
        //         //alert("iOS");
        //         window.location.href = 'https://apps.apple.com/cn/app/%E4%BA%91%E5%B0%9A%E5%A5%A5%E8%8E%B1/id1465194574';
        //     } else if ( /android/.test(ua)) { // 安卓系统 -> 跳安卓端下载地址
        //         // header('Content-Type: application/octet-stream');
        //         // header('Content-Disposition: attachment; filename="/download.zip"');
        //         // header('Content-Transfer-Encoding: binary');
        //         // // load the file to send:
        //         // readfile('ysal-release.apk');
        //         window.location.href = 'https://a.app.qq.com/o/simple.jsp?pkgname=com.yunshang.ecmall';
        //         //alert("android");
        //     } else if (IsPC()){ // PC端
        //
        //     }
        // }
    </script>
</html>